package com.oasystem.service.fund;

import java.util.List;

import com.oasystem.dao.jdbc.fund.FundApplicationDao;
import com.oasystem.domain.PagingBean;
import com.oasystem.domain.fund.FundApplication;
import com.oasystem.utils.DateUtils;
import com.oasystem.web.webbean.fund.FunOutcomeSummary;

public class FundApplicationService {
	private FundApplicationDao fundApplicationDao;

	public void insert(FundApplication fundApplication) {
		fundApplication.setApplyTime(DateUtils.getCurrentTimeString());
		fundApplicationDao.insert(fundApplication);
	}

	public void update(FundApplication fundApplication) {
		fundApplicationDao.update(fundApplication);
	}

	public void setFundApplicationDao(FundApplicationDao fundApplicationDao) {
		this.fundApplicationDao = fundApplicationDao;
	}

	public void fundApplicationHistory(String applicant,
			PagingBean<FundApplication> pagingBean) {
		this.fundApplicationDao.fundApplicationHistory(applicant, pagingBean);
	}

	public void fundApplicationListForCheck(String approver,
			PagingBean<FundApplication> pagingBean) {
		this.fundApplicationDao.fundApplicationListForCheck(approver,
				pagingBean);
	}

	public void approveFundApplication(String fundApplicationId) {
		this.fundApplicationDao.approveFundApplication(fundApplicationId);
	}

	public void rejectFundApplication(String fundApplicationId, String reason) {
		this.fundApplicationDao
				.rejectFundApplication(fundApplicationId, reason);

	}

	public double totalFundOutcome() {
		return this.fundApplicationDao.totalFundOutcome();
	}

	public List<FunOutcomeSummary> fundOutcomeSummaryList() {
		return this.fundApplicationDao.fundOutcomeSummaryList();
	}

	public List<FunOutcomeSummary> searchSummary(String from, String to) {
		from = from + " 00:00:00";
		to = to + " 23:59:59";
		return this.fundApplicationDao.fundOutcomeSummaryList(from,to);
	}
}
